x86: INT3 and INTO trap gates should have DPL==3.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Jan 2008 11:29:15 +0000 (11:29 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Jan 2008 11:29:15 +0000 (11:29 +0000)
This was broken by c/s 16667 (gdbstub changes).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/traps.c

index 9e7ade8c9084fd04bc6a9d7a415443dc240c5d27..25fa48623f5f05b7df578b968d65cb7dcc6cc07a 100644 (file)
@@ -2679,14 +2679,24 @@ asmlinkage void do_spurious_interrupt_bug(struct cpu_user_regs *regs)
 {
 }
 
-void set_intr_gate(unsigned int n, void *addr)
+static void __set_intr_gate(unsigned int n, uint32_t dpl, void *addr)
 {
     int i;
     /* Keep secondary tables in sync with IRQ updates. */
     for ( i = 1; i < NR_CPUS; i++ )
         if ( idt_tables[i] != NULL )
-            _set_gate(&idt_tables[i][n], 14, 0, addr);
-    _set_gate(&idt_table[n], 14, 0, addr);
+            _set_gate(&idt_tables[i][n], 14, dpl, addr);
+    _set_gate(&idt_table[n], 14, dpl, addr);
+}
+
+static void set_swint_gate(unsigned int n, void *addr)
+{
+    __set_intr_gate(n, 3, addr);
+}
+
+void set_intr_gate(unsigned int n, void *addr)
+{
+    __set_intr_gate(n, 0, addr);
 }
 
 void set_tss_desc(unsigned int n, void *addr)
@@ -2753,8 +2763,8 @@ void __init trap_init(void)
     set_intr_gate(TRAP_divide_error,&divide_error);
     set_intr_gate(TRAP_debug,&debug);
     set_intr_gate(TRAP_nmi,&nmi);
-    set_intr_gate(TRAP_int3,&int3);         /* usable from all privileges */
-    set_intr_gate(TRAP_overflow,&overflow); /* usable from all privileges */
+    set_swint_gate(TRAP_int3,&int3);         /* usable from all privileges */
+    set_swint_gate(TRAP_overflow,&overflow); /* usable from all privileges */
     set_intr_gate(TRAP_bounds,&bounds);
     set_intr_gate(TRAP_invalid_op,&invalid_op);
     set_intr_gate(TRAP_no_device,&device_not_available);